<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <title>send_request (OpenSocial::Request)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File lib/opensocial/request.rb, line 61</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_request</span>(<span class="ruby-identifier">service</span>, <span class="ruby-identifier">guid</span>, <span class="ruby-identifier">selector</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">pid</span> = <span class="ruby-keyword kw">nil</span>,
                     <span class="ruby-identifier">unescape</span> = <span class="ruby-keyword kw">false</span>)
      <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@connection</span>
        <span class="ruby-identifier">raise</span> <span class="ruby-constant">RequestException</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Request requires a valid connection.'</span>)
      <span class="ruby-keyword kw">end</span>
      
      <span class="ruby-identifier">uri</span> = <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">service_uri</span>(<span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">container</span>[<span class="ruby-identifier">:rest</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">service</span>,
                                    <span class="ruby-identifier">guid</span>, <span class="ruby-identifier">selector</span>, <span class="ruby-identifier">pid</span>)
      <span class="ruby-identifier">data</span> = <span class="ruby-identifier">dispatch</span>(<span class="ruby-identifier">uri</span>)
      
      <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">unescape</span>
        <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">data</span>.<span class="ruby-identifier">os_unescape</span>)
      <span class="ruby-keyword kw">else</span>
        <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">data</span>)
      <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">end</span></pre>
</body>
</html>